import ajax from "./index";
// 注册
export const reg = (data) =>{
    return ajax({
        url:'/api/reg',
        method:'post',
        data
    })
}
// 登录
// /api/login

export const Login = (data) =>{
    return ajax({
        url:'/api/login',
        method:'post',
        data
    })
}
// 用户信息
export const userinfo = () =>{
    return ajax({
        url:'/my/userinfo',
        method:'get',
        
       
    })
}
// 侧边栏  /my/menus

export const Menus = () =>{
    return ajax({
        url:'/my/menus',
        method:'get',
        
       
    })
}
// 修改  /my/userinfo

export const updataserinfo = (data) =>{
    return ajax({
        url:'/my/userinfo',
        method:'put',
        data
        
       
    })
}
// 上传头像  /my/update/avatar

export const updateAvatar = (avatar) =>{
    return ajax({
        url:'/my/update/avatar',
        method:'PATCH',
        data:{
            avatar
        }
        
       
    })
}
// 更新-用户密码    
// /my/updatepwd

export const updatepwd = ({old_pwd,new_pwd,re_pwd,}) =>{
    return ajax({
        url:'/my/updatepwd',
        method:'PATCH',
        data:{
            old_pwd,
            new_pwd,
            re_pwd,
        }
        
       
    })
}
// 获取分类  /my/cate/list
export const updatacatelist = () =>{
    return ajax({
        url:'/my/cate/list',
        method:'get',      
    })
}
// 添加分类  /my/cate/add
export const updatacateadd = ({ cate_name, cate_alias }) =>{
    return ajax({
        url:'/my/cate/add',
        method:'post',   
        data:{ cate_name, cate_alias}   
    })
}
// 发布文章  /my/article/add
export const updatarticle = (fd) =>{
    return ajax({
        url:'/my/article/add',
        method:'post',   
        data:fd
    })
}
// 文章列表  /my/article/list

export const article = (params) =>{
    return ajax({
        url:'/my/article/list',
        method:'get',   
        params
    })
}